package common


import (
	"strconv"
	"github.com/micro/go-micro/v2/registry"
	"github.com/micro/go-plugins/registry/consul/v2"
)

//注册服务器
func RegConsul(port int64, mode string) registry.Registry  {
	var host ="127.0.0.1"
	if mode == "docker" {
		host = "consul-url"
	}
	return consul.NewRegistry(func(options *registry.Options) {
		options.Addrs = []string{
			host+":"+strconv.FormatInt(port,10),
		}
	})
}